#ifndef SYSYF_ACTIVEVAR_H
#define SYSYF_ACTIVEVAR_H

#include "Pass.h"
#include "Module.h"
#include <set>
#include <map>
#include <list>
#include <vector>
#include <memory>

class ActiveVar : public Pass
{
public:
    ActiveVar(Module *module) : Pass(module) {}
    void execute() final;
    const std::string get_name() const override {return name;}
    void post_tra(BasicBlock* bb,std::set<BasicBlock*>& visited);
    void ans(Function* function);
    void init(Function* function);

private:
    Function *func_;
    const std::string name = "ActiveVar";
    std::list<BasicBlock*> bb_list;
    std::map<BasicBlock*,int> bb_int;
    std::vector<std::set<Value*>> bb_def;
    std::vector<std::set<Value*>> bb_use;
    std::vector<std::set<Value*>> bb_in;
    std::vector<std::set<Value*>> bb_out;
    std::vector<std::set<Value*>> bb_phi;
};

#endif  // SYSYF_ACTIVEVAR_H